import { defineStore } from 'pinia'
import { getLeaveApplication, getTravelRequisition, getLoanApplication, getWork, getCustomerVisits, getTicket } from "../api/custom"
export const useStore = defineStore('main', {
  state: () => ({
    counter: 0,
    tableData: [{}],
    tableDataTwo: [{}],
    tableDataThree: [{}],
    tableDataFour: [{}],
    tableDataFive: [{}],
    tableDataSix: [{}],
  }),
  getters: {
    doubleCount: (state) => state.counter * 2,
  },
  actions: {
    async getLeaveApplicationS() {
      this.tableData = await getLeaveApplication()
      console.log(this.tableData, "sidxfugsfdghjksdfgkjh")
    },
    async getTravelRequisitionS() {
      this.tableDataTwo = await getTravelRequisition()
      console.log(this.tableDataTwo, "sidxfugsfdghjksdfgkjh")
    },
    async getLoanApplicationS() {
      this.tableDataThree = await getLoanApplication()
      console.log(this.tableDataThree, "sidxfugsfdghjksdfgkjh")
    },
    async getWorkS() {
      this.tableDataFour = await getWork()
      console.log(this.tableDataFour, "sidxfugsfdghjksdfgkjh")
    },
    async getCustomerVisitsS() {
      this.tableDataFive = await getCustomerVisits()
      console.log(this.tableDataFive, "sidxfugsfdghjksdfgkjh")
    }, async getTicketS() {
      this.tableDataSix = await getTicket()
      console.log(this.tableDataSix, "sidxfugsfdghjksdfgkjh")
    }
  }
})